// acr_algo_dotnet_wrapper.h
#pragma once


#using <mscorlib.dll>
#using <System.dll>
#using <System.Drawing.dll>
#include <vector>
#include "contour_finder.h"



using namespace System;
using System::Drawing::Point;



namespace acr_algo_dotnet_wrapper {
	public ref class Acr_Wrapper {
	public:
		static array<Point>^ GetHandCountour(array<Byte>^ img_data) {
			::std::vector<unsigned char> img;
			img.reserve(img_data->Length);

			for ( int i = 0 ; i != img_data->Length ; i++ ) {
				unsigned char tmp = img_data[i];
				img.push_back(tmp);
			}

			
			acr::Point *contour;
			size_t contour_size;
			acr::getHandContour(&img.front(), img.size(), &contour, &contour_size);

			array<Point>^ result = gcnew array<Point>(contour_size);
			for ( size_t i = 0 ; i != contour_size ; ++i ) {
				result[i] = Drawing::Point(contour[i].x, contour[i].y);
			}

			acr::releaseContour(contour);

			return result;
		}
	};
}